#python单例模式代码编写
class Singleton(object):#[ˈsɪŋɡltən]
    __instance = None #Singleton这个实例的对象

    # def __init__(self):
    #     pass
    def __new__(cls, *args, **kwargs):
        #__new__() 是一种负责创建类实例的静态方法，它无需使用 staticmethod 装饰器修饰，且该方法会优先 __init__() 初始化方法被调用。
        if Singleton.__instance is None:
            Singleton.__instance=object.__new__(cls,*args, **kwargs)
            print(cls)
        return Singleton.__instance

one=Singleton()
two=Singleton()
print(id(one))  # 2488569943376
print(id(two))  # 2488569943376
print(one == two)   # True
print(one is two)   # True